package com.xiong.proxy.Interceptor;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class CommonMethodInterceptor implements MethodInterceptor {

    private Class<?> cls;

    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        Object result;
        System.out.println("执行前");
        result=methodProxy.invokeSuper(o, objects);
        System.out.println("执行后");
        return result;
    }

    public CommonMethodInterceptor(Class<?> cls){
        this.cls=cls;
    }
}
